const TOKEN_KEY = 'sc_token';
export const USER_INFO_KEY = 'sc_user';

// 存储token
export const setToken = (token: string) => {
  localStorage.setItem(TOKEN_KEY, token);
};

// 获取token
export const getToken = (): string | null => {
  return localStorage.getItem(TOKEN_KEY);
};

// 清除token
export const removeToken = () => {
  localStorage.removeItem(TOKEN_KEY);
};

// 存储通用数据
export const setStorage = (key: string, value: any) => {
  localStorage.setItem(key, JSON.stringify(value));
};

// 获取通用数据
export const getStorage = (key: string) => {
  const value = localStorage.getItem(key);
  return value ? JSON.parse(value) : null;
};